Function: insertMarkup(stringMarkup, domInsertionElement, stringPositionToken, functionCallback(domInsertionElement)) Description: Inserts a markup string into a specified target location in the DOM. Returns: domElement, or $A object if chained. Note: If stringPositionToken is not set to a valid token value, innerHTML will be used instead, and all preexisting content will be cleaned and removed to prevent memory leaks. Available position tokens: "before", "after", "prepend", or "append". Example: // Insert a markup string element at the top of another DOM element var myElement = $A.insertMarkup('
Here we are now, entertain us.
', domElement, "prepend"); // Insert a markup string element after another DOM element and exicute a callback when done var myElement = $A.insertMarkup('', domFormInputElement, "after", function(domFormInputElement) { $A(domFormInputElement).addIdReference("aria-describedby", "tooltipId").focus(); }); // Or the same using chaining // Insert a markup string element at the top of another DOM element var myChain = $A(domElement).insertMarkup('
Here we are now, entertain us.
', "prepend"); // Insert a markup string element after another DOM element and exicute a callback when done var myChain = $A(domFormInputElement).insertMarkup('', "after", function(domFormInputElement) { $A(domFormInputElement).addIdReference("aria-describedby", "tooltipId").focus(); }); // To return the modified element within a chain, use the "return()" method. var myElement = myChain.return();